#ifndef VECTOR3D_H
#define VECTOR3D_H

namespace RayTracer
{
	#define DOT(A,B)		(A.x*B.x+A.y*B.y+A.z*B.z)
	#define DOTP(A,B)		(A->x*B->x+A->y*B->y+A->z*B->z)
	#define NORMALIZE(A)	{float l=1/sqrtf(A.x*A.x+A.y*A.y+A.z*A.z);A.x*=l;A.y*=l;A.z*=l;}
	#define LENGTH(A)		(sqrtf(A.x*A.x+A.y*A.y+A.z*A.z))

    class Vector3D
    {
    public:
    float x;
	float y;
	float z;

	static float Dot(const Vector3D *l, const Vector3D *r);
	static Vector3D MultiplyN(const Vector3D *l, const Vector3D *r);
	static void Multiply(Vector3D *vector, float scale);
	static float Length(const Vector3D *vector);
	static void Normalize(Vector3D *vector);
	static Vector3D Add(const Vector3D *l, const Vector3D *r);
	static Vector3D Add(const Vector3D *l, float scalar);
	static Vector3D Subtract(const Vector3D *l, const Vector3D *r);
	static Vector3D Subtract(const Vector3D *l, float scalar);
	static Vector3D MultiplyN(const Vector3D *vector, float scale);
	static Vector3D Cross(const Vector3D *l, const Vector3D *r);
	static Vector3D Empty();
	    
	Vector3D();
	Vector3D(float x, float y, float z);
	Vector3D(const Vector3D &prototype);
    };
};
#endif
